package com.jushu.storbox;


import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.jushu.storbox.manager.ActivityTaskManager;
import com.jushu.storbox.util.LogUtil;
import com.jushu.storbox.util.PublicTools;

public class CopyrightActivity extends BaseTitleActivity{
	private final static String LOG_TAG = "CopyrightActivity";
	private Button copyright_welcome_bt;
	private TextView version_tv;
//	private TextView copyright_article_and_privacy;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		LogUtil.i(LOG_TAG, "onCreate()");
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_copyright);
		switchInvite();
		setCurrentTitle(R.string.copyright);
		ActivityTaskManager.getInstance().putActivity(LOG_TAG, CopyrightActivity.this);
		initView();
		initListener();
		initData();
	}
	
	@Override
	protected void onLeftClicked(View clickView) {
		CopyrightActivity.this.finish();
		super.onLeftClicked(clickView);
	}

	private OnClickListener welcomeListener=new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent intent=new Intent(CopyrightActivity.this,WelcomeActivity.class);
			intent.putExtra("isWelcomeButton", true);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			startActivity(intent);
		}
	};
	
	private OnClickListener userArticleListener=new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent intent=new Intent(CopyrightActivity.this,UserArticleActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			startActivity(intent);
		}
	};
	
	private void initData() {
		// TODO Auto-generated method stub
		version_tv.setText(CopyrightActivity.this
				.getString(R.string.setting_app_version_text)
				+ PublicTools.getVersionName(CopyrightActivity.this));
	}
	
	private void initListener() {
		// TODO Auto-generated method stub
		copyright_welcome_bt.setOnClickListener(welcomeListener);
//		copyright_article_and_privacy.setOnClickListener(userArticleListener);
	}

	private void initView() {
		// TODO Auto-generated method stub
		copyright_welcome_bt=(Button) findViewById(R.id.copyright_welcome_bt);
//		copyright_article_and_privacy=(TextView)findViewById(R.id.copyright_article_and_privacy);
		version_tv=(TextView) findViewById(R.id.copyright_version_tv);
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		LogUtil.i(LOG_TAG, "onDestroy()");
		super.onDestroy();
		ActivityTaskManager.getInstance().removeActivity(LOG_TAG);
	}
}
